package kotan.datastore.api;

import java.io.Serializable;
import java.util.Arrays;

public class Blob implements Serializable {

    private static final long serialVersionUID = 1L;
    byte[] bytes;

    public Blob() {
    }

    public Blob(byte[] bytes) {
        this.bytes = bytes;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + Arrays.hashCode(bytes);
        return result;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        Blob other = (Blob) obj;
        if (!Arrays.equals(bytes, other.bytes)) return false;
        return true;
    }

}
